M = {}

local newPlanet = function(imageSheet,sheet,x, y,radio,atmosfera)
    local pran= math.random (1, 5)
    --planeta = display.newImageRect("planet"..tostring(pran)..".png", radio *2,radio * 2)
    local planeta = display.newImageRect(imageSheet,sheet, radio *2,radio * 2)
    --planeta = display.newCircle( x, y, radio )
    planeta.x = x
    planeta.y = y
    --planeta:setFillColor(255, 0, 0)
    planeta.radio= radio
    planeta.gravity = radio/50
    physics.addBody(planeta, "static", { density = 0.8, friction = 0.0, bounce = 0.0, radius = radio })
    
    planeta.atmosfera=atmosfera

    --atmosfera
    planeta.atmosferaCircle=display.newImageRect(imageSheet,1, (radio + atmosfera) *2,(radio + atmosfera) * 2)
    planeta.atmosferaCircle.x=x
    planeta.atmosferaCircle.y=y
    planeta.atmosferaCircle.alpha = 0.5

    planeta.tipo= "PLANETA"
    return planeta
end

M.newPlanet = newPlanet

return M